package com.laxia.exception.ensure.extensions;

import com.laxia.exception.ExceptionFactory;
import com.laxia.exception.ensure.EnsureParam;

import java.util.Objects;


public class EnsureParamObjectExtension extends EnsureParam<Object> {

    public EnsureParamObjectExtension(Object o) {
        super(o);
    }

    public EnsureParamObjectExtension isNull(String errMsg, Object... objects) {
        if (Objects.nonNull(this.t)) {
            throw ExceptionFactory.create(errMsg, objects);
        } else {
            return this;
        }
    }

    public EnsureParamObjectExtension isNotNull(String errMsg, Object... objects) {
        if (Objects.isNull(this.t)) {
            throw ExceptionFactory.create(errMsg, objects);
        } else {
            return this;
        }
    }


}
